#pragma once
#include <QString>
#include <QStringList>
#include <QTreeWidgetItem>
#include <QTime>
#include <QCoreApplication>

#include "ServiceServerDirectory.h"
#include "ServiceGetLogicDeviceDirectory.h"
#include "ServiceGetLogicNodeDirectory.h"
#include "ServiceGetDataDefinition.h"
#include "ServiceGetDataDirectory.h"
#include "ServiceGetDataValues.h"
#include "ServiceGetDataSetDirectory.h"
#include "ServiceGetDataSetValues.h"
#include "XmlRW.h"
class CServerModel
{
public:
    CServerModel(void);
    virtual ~CServerModel(void);
    BOOL ServerDirectory(QStringList *ServerDirectory);
    BOOL LogicDeviceDirectory(QStringList *LogicDeviceDirectory);
    BOOL LogicNodeDirectory(QStringList *LogicNodeDirectory);
    BOOL ProcGetServerDirectory(int iClass, CMTree & tree);
    BOOL ProcGetLogicDeviceDirectory(const char * szLDRef, CMTree & tree);
    BOOL ProcGetLogicNodeDirectory(const char * szLNRef, int iClass,
                                   CMTree & tree);
    BOOL ProcGetDataValues(const char * szDataRef, CMTree & tree);
    BOOL ProcGetDataDirectory(const char * szDataRef, CMTree & tree);
    BOOL ProcGetDataDefinition(const char * szDataRef, CMTree & tree);
    BOOL ProcGetDataSetDirectory(const char * szDataSetRef, CMTree & tree);
    BOOL ProcGetDataSetValues(const char * szDataSetRef, CMTree & tree);
    BOOL SetTreeItem(QTreeWidgetItem *treeItem);
    BOOL SetXml(QDomNode xml);
    BOOL SetDataSetItem(QTreeWidgetItem *treeItem);
    void SetVerion(int mainVerion,int subVersion,int releaseNo);
    void GetVersion();
    void AppSleep(int ms);
private:
    CServiceServerDirectory *m_ServerDirectory;
    CServiceGetLogicDeviceDirectory *m_LogicDeviceDirectory;
    CServiceGetLogicNodeDirectory *m_LogicNodeDirectory;
    CServiceGetDataValues *m_DataValues;
    CServiceGetDataDirectory *m_DataDirectory;
    CServiceGetDataDefinition *m_DataDefinition;
    CServiceGetDataSetDirectory *m_GetDataSetDirectory;
    CServiceGetDataSetValues *m_GetDataSetValues;

    int m_mainVerion;
    int m_subVersion;
    int m_releaseNo;
    static int mainVer;

};
